package com.vrv.vap.uploader.service.impl;

import com.baomidou.dynamic.datasource.annotation.Master;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.vrv.vap.uploader.mapper.FileMapper;
import com.vrv.vap.uploader.model.FileDto;
import com.vrv.vap.uploader.service.FileListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wh1107066
 * @date 2021/9/29 19:36
 */
@Service
public class FileListServiceImpl implements FileListService {
    @Autowired(required = false)
    private FileMapper fileMapper;

    @Master
    @Override
    public PageInfo<FileDto> findByPageService(FileDto fileDto, int pageNum, int pageSize) {
        //使用Mybatis分页插件
        PageHelper.startPage(pageNum, pageSize);
        //调用分页查询方法，其实就是查询所有数据，mybatis自动帮我们进行分页计算
        List<FileDto> fileInfos = fileMapper.getListByFile(fileDto);
        PageInfo<FileDto> fileDTOPageInfo = new PageInfo<>(fileInfos);
        return fileDTOPageInfo;
    }
}